package Main;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import javax.swing.JButton;
import javax.swing.JPanel;

/**
 *
 * @author Ziad Aloulou
 */
public class Bienvenue extends JPanel {

    //
    private Frame frame;
    public BorderLayout mainLayout;
    public JButton btnPoker;
    public JButton btnBlackJack;
    public JButton btnRoulette;
    public JButton btnSlots;
    //
    public Image IMAGE_BLACKJACK = Toolkit.getDefaultToolkit().createImage("Images/Blackjack.JPG");
    public Image IMAGE_POKER = Toolkit.getDefaultToolkit().createImage("Images/Poker.JPG");
    Evenements evenements;

    public Bienvenue(Frame frame) {
        this.frame = frame;
        frame.setSize(615, 615);
        setBackground(Color.red);
        evenements = new Evenements(frame, this);
        init();
        btnPoker.setMnemonic(KeyEvent.VK_P);
        btnBlackJack.setMnemonic(KeyEvent.VK_B);
        btnRoulette.setMnemonic(KeyEvent.VK_R);
        btnSlots.setMnemonic(KeyEvent.VK_S);
        addActionListener();
        this.add(btnPoker);
        this.add(btnBlackJack);
        this.add(btnRoulette);
        this.add(btnSlots);
    }

    public void init() {
        btnPoker = new JButton("Poker");
        btnBlackJack = new JButton("BlackJack");
        btnRoulette = new JButton("Roulette");
        btnSlots = new JButton("Slots");
    }

    public void addActionListener() {
        btnPoker.addActionListener(evenements);
        btnBlackJack.addActionListener(evenements);
        btnRoulette.addActionListener(evenements);
        btnSlots.addActionListener(evenements);
//        frame.mnuQuitter.addActionListener(evenements);
    }
    private Graphics2D g2d;

    @Override
    public void paintComponent(Graphics g) {

        g2d = (Graphics2D) g;
        g2d.setColor(Color.BLUE);
        g2d.fillRect(0, 0, 650, 650);
        g2d.setColor(Color.GRAY);
        g2d.fillRect(110, 75, 400, 235);
        g2d.fillOval(10, 75, 200, 235);
        g2d.fillOval(400, 75, 200, 235);
        g2d.setColor(Color.GREEN);
        g2d.fillRect(120, 85, 390, 215);
        g2d.fillOval(20, 85, 190, 215);
        g2d.fillOval(400, 84, 190, 216);
        g2d.setColor(Color.red);
        g2d.drawImage(IMAGE_BLACKJACK, 190, 240, null);
        g2d.drawImage(IMAGE_POKER, 230, 170, null);
        g2d.setFont(new Font("Eras Demi ITC", 1, 50));
        g2d.setColor(Color.RED);

        g2d.drawString("CASINO VZB", 135, 150);
    }
}
